﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "ElementId.h"
#include <vector>
#include "GmFamilyUtils.h"

namespace gcmp
{
    class IDocument;
    class Matrix4d;
    class ElementId;

}

namespace gfam
{

    /// \brief 镜像操作的工具类
    class GM_FAMILY_UTILS_EXPORT FamilyMirrorUtils
    {
    public:

        /// \brief 对 elements 进行镜像操作
        /// \param pDocument [in] 图形所属的文档
        /// \param toBeMirroredElementIds [in] 期望被镜像的 elements 的 Id
        /// \param mirrorMatrix [in] 镜像矩阵
        /// \param isCopyBeforeMirror [in] true-镜像前拷贝即将被镜像的 elements 并将副本留在原地，false-不拷贝直接镜像
        /// \param mirroredElementIds [out] 被成功镜像的源 elements 的 Id，都是可拷贝对象，如果函数执行失败，此参数无效
        /// \param pStringError [out] 错误信息，如果函数执行成功，此参数无效
        /// \return 操作成功则返回true，否则返回false
        static bool MirrorElements(
            gcmp::IDocument* pDocument, 
            const std::vector<gcmp::ElementId>& toBeMirroredElementIds,
            const gcmp::Matrix4d& mirrorMatrix,
            bool isCopyBeforeMirror,
            std::vector<gcmp::ElementId>& mirroredElementIds,
            std::wstring* pStringError = nullptr);
    };
}
